﻿<li class="dc-sub-menu-header @(IsOpen ? "open" : string.Empty)">
    <span onclick="@ToggleSubMenu"><i onclick="@ToggleSubMenu">@Icon</i> @Header</span>
    <ul class="dc-sub-menu">
        @ChildContent
    </ul>
</li>

@functions {
    [Parameter] protected string Header { get; set; }
    [Parameter] protected string IconClass { get; set; }
    [Parameter] protected string Disabled { get; set; }
    [Parameter] protected RenderFragment ChildContent { get; set; }

    protected string Icon { get; set; } = "+";
    protected bool IsOpen { get; set; }

    protected void ToggleSubMenu()
    {
        IsOpen = !IsOpen;
        Icon = IsOpen ? "-" : "+";
    }
}